package com.un.ebs.invoice.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import com.un.ebs.core.enums.BooleanEnum;
import com.un.ebs.invoice.domain.*;
import com.un.ebs.invoice.dto.*;
import com.un.ebs.invoice.enums.InvoiceCashTypeEnum;
import com.un.ebs.invoice.enums.InvoiceTypeEnum;
import com.un.ebs.sale.dto.SaleOrderNotInvoiceView;

import java.util.Date;
import java.util.List;

/**
 * (InvoiceNote)表服务接口
 *
 * @author liubo
 * @since 2020-09-27 11:06:42
 */
public interface InvoiceNoteService extends IService<InvoiceNote> {

    void save(InvoiceNoteUpdateDto req);

    void delete(String id);

    void updateFinanceCode(String id, String financeId, String financeCode);

    String submit(String id);

    void submitCancel(String id);

    String audit(InvoiceAuditDto req);

    void auditCancel(String id);

    InvoiceCashNote cash(String entId, Double money, Date cashDate, InvoiceCashTypeEnum type, String moneyType, String remark);

    /**
     * 发票反冲
     *
     * @param id
     */
    void back(String id, String remark);

    /**
     * 现金认领
     *
     * @param cashNoteId    现金记录ID
     * @param invoiceNoteId 发票ID
     * @param claimMoney    认领金额
     */
    void cashClaim(String cashNoteId, String invoiceNoteId, Double claimMoney);

    void deleteCash(String id);

    /**
     * 删除认领记录
     *
     * @param id
     */
    void deleteCashClaim(String id);

    void workflowPass(String noteId, String workflowInstanceId);

    InvoiceCashNoteExt queryCashViewById(String id);

    /**
     * 查询当前用户的名下的销售发票
     *
     * @param pageSize
     * @param pageIndex
     * @return
     */
    IPage<InvoiceNoteExt> queryMyInvoice(Boolean isCash, Integer pageSize, Integer pageIndex);

    InvoiceNoteVo queryViewById(String id);

    IPage<InvoiceNoteExt> query(InvoiceTypeEnum invoiceType, Integer accountYear, Integer accountMonth, Integer pageSize, Integer pageIndex);

    IPage<InvoiceNoteExt> queryWaitAudit(Integer pageSize, Integer pageIndex);

    InvoiceCashVo queryCashInfo(String cashId);

    IPage<InvoiceNoteByPurchase> queryPurchase(Integer accountYear, Integer accountMonth, Integer pageSize, Integer pageIndex);

    List<InvoiceNoteByPurchaseSum> queryPurchaseSum(int accountYear, int accountMonth);

    List<InvoiceNoteItemByPurchase> queryPurchaseItem(String noteId);

    IPage<InvoiceCashNoteExt> queryCash(String entId, Integer cashYear, Integer cashMonth, int pageSize, int pageIndex);

    IPage<InvoiceCashNoteExt> queryCash(int pageSize, int pageIndex);

    List<InvoiceCashNoteItemExt> queryCashClaim(String cashNoteId);

    List<InvoiceCashNoteItemExt> queryCashClaimByInvoice(String invoiceNoteId);

    IPage<InvoiceNoteExt> queryNotCash(String entId, int pageSize, int pageIndex);

    List<InvoiceNoteItemExt> queryItem(String noteId);

    IPage<InvoiceNoteItemAllExt> queryItem(InvoiceItemQueryRequest req);

    IPage<InvoiceNoteItemBySaleExt> queryItemBySale(String noteId, int pageSize, int pageIndex);

    List<InvoiceNoteItemExt> queryItemBySaleContractCode(String contractCode);

    List<InvoiceNoteExt> queryNotSendFinance(InvoiceTypeEnum invoiceType, int accountYear, int accountMonth);

    IPage<SaleNotInvoiceExt> querySaleNotInvoice(int pageSize, int pageIndex);

    List<InvoiceBalanceDto> queryInvoiceBalance(String entName, InvoiceTypeEnum invoiceType);

    List<SaleOrderNotInvoiceView> querySaleNotInvoiceByService();

    List<AccountAgeDto> queryAccountAge();

}